<template>
  <view>
    <u-navbar title="医生随访" back-icon-size="34" title-size="36" :border-bottom="false" :background="background" title-color="#222" back-icon-color="#222"></u-navbar>
    <view class="">
      <u-tabs :list="lists" :is-scroll="false" :current="current1" @change="change" bg-color="#f8f8f8"></u-tabs>
    </view>
    <view class="" style="margin: 20rpx 28rpx; background: #fff; border-radius: 20rpx" v-for="(i, k) in getlist" :key="k" @tap="chat(i)">
      <view class="" style="display: flex; justify-content: space-between; padding: 44rpx 22rpx 11rpx 26rpx">
        <view class="" style="display: flex; align-items: flex-start">
          <view class="">
            <image :src="i.doctor.doctor_avatar" mode="aspectFill" style="width: 112rpx; height: 112rpx; border-radius: 50%"></image>
          </view>
          <view class="" style="padding-left: 18rpx">
            <view class="">
              <text style="font-size: 30rpx; font-weight: bold">{{ i.doctor.doctor_name }}</text>
              <!-- <text style="font-size: 26rpx;padding-left: 20rpx;">主任医师</text> -->
            </view>
            <view class="" style="font-size: 26rpx; color: #666; padding-top: 29rpx">
              {{ i.last_log }}
            </view>
          </view>
        </view>
        <view class="" style="font-size: 24rpx; color: #666">
          {{ i.create_time_text }}
        </view>
      </view>
      <view class="" style="font-size: 26rpx; text-align: right; padding-right: 19rpx; padding-bottom: 18rpx">就诊人：{{ i.user_patient.patient_name }}</view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      background: {
        background: '#FFFFFF'
      },
      lists: [
        {
          name: '全部'
        },
        {
          name: '未完成'
        }
      ],
      current1: 0,
      id: null,
      getlist: []
    };
  },
  methods: {
    change(index) {
      this.current1 = index;
    },
    all() {
      this.api({
        url: '/api/patient/getDoctorVisitList',
        method: 'post',
        data: {
          style: this.current1,
          patient_id: this.id
        }
      }).then((res) => {
        this.getlist = res.data.data;
      });
    },
    chat(e) {
      uni.navigateTo({
        url: '/chat/chat/chat?id=' + e.doctor_id + '&patient_id=' + this.id
      });
    }
  },
  onLoad(op) {
    this.id = op.id;
  },
  onShow() {
    this.all();
  }
};
</script>

<style>
page {
  background: #f8f8f8;
}
</style>
